#!/usr/bin/python

from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask import render_template
from flask import request


class AdsList(Resource):
    offset = (pagenum-1)*maxline
    limit = maxline
    ads_list = ADS.query.order_by(ADS.id.desc()).limit(10).offset(0).all()
    adslist = []
    tmp_list = []
    for i in ads_list:
	adslist.append(i)
    for ads in adslist:
	tmp = {}
	tmp['ads_id'] = ads.id
	tmp['ads_sex'] = ads.sex
	tmp['ads_age'] = ads.age
	tmp['ads_num'] = ads.num
	tmp['ads_address'] = ads.address
	tmp['ads_grade'] = ads.grade
	tmp['ads_sub'] = ads.sub
	tmp['ads_name'] = ads.name

api.add_resource(AdsList,'noticelist/maxline/<int:maxline>/pagenum/<int:pagenum>/')
